﻿
@{
    ViewBag.Title = "发表问题";
    Layout = "~/Views/Shared/_LayoutPage.cshtml";


    var categories = ViewBag.PostCategories as IList<Fly.Domain.Models.PostCategory>;
}


<div class="main layui-clear">
    <h2 class="page-title">发表问题</h2>

    <!-- <div class="fly-none">并无权限</div> -->

    <div class="layui-form layui-form-pane">
        <form  method="post">
            @Html.AntiForgeryToken()
            <div class="layui-form-item">
                <label for="L_title" class="layui-form-label">标题</label>
                <div class="layui-input-block">
                    <input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <div class="layui-input-block">
                    <textarea id="L_content" name="content" required lay-verify="required" placeholder="请输入内容" class="layui-textarea fly-editor" style="height: 260px;"></textarea>
                </div>
                <label for="L_content" class="layui-form-label" style="top: -2px;">描述</label>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">所在类别</label>
                    <div class="layui-input-block">
                        <select lay-verify="required" name="postCateogryId">
                            <option></option>
                            @if (categories != null && categories.Count > 0)
                            {
                                foreach (var item in categories)
                                {
                                    <option value="@item.Id">@item.CategoryName</option>
                                }
                            }
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">悬赏飞吻</label>
                    <div class="layui-input-block">
                        <select name="reward">
                            <option value="5" selected>5</option>
                            <option value="20">20</option>
                            <option value="50">50</option>
                            <option value="100">100</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_vercode" class="layui-form-label">人类验证</label>
                <div class="layui-input-inline">
                    <input type="text" id="L_vercode" name="vercode" required lay-verify="required" placeholder="请回答后面的问题" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid">
                    @*<span style="color: #c00;">1+1=?</span>*@
                    <img id="valiCode" src="@Url.Action("GetValidateCode", "ValidateCode", new { v = DateTime.Now.Ticks })" style="cursor:pointer;" alt="验证码" />
                </div>
            </div>
            <div class="layui-form-item">
                <button class="layui-btn" lay-filter="*" lay-submit>立即发布</button>
            </div>
        </form>
    </div>
</div>
@section scripts{
    <script>
        layui.use(['jquery','form'], function () {
            var $ = layui.jquery;

            $('#valiCode').off('click').on('click', function () {
                this.src = '@Url.Action("GetValidateCode", "ValidateCode")?v=' + new Date().getTime();
             });
        });
    </script>
}

